<template>
	<div class="flexcenter">
		<div class="max_width paddingtb">
			<div class="mainpadding ffffff radius margin_bottom3" v-for="item in list.data" :key="item.id">
				<div class="flexleft">
					<div class="text_h color_theme margin_right3">{{item.name}}</div>
					<div class="text_b color_nine">{{item.createtime_text}}</div>
				</div>
				<div class="text_d color_three margin_top2 word_wrap">{{item.content}}</div>
			</div>
			<div class="flexcenter margin_top" v-if="list.total > 12">
				<el-pagination background layout="prev, pager, next" :page-size="12" :total="list.total"
					@current-change="tuijianchange">
				</el-pagination>
			</div>
		</div>
	</div>
</template>

<script>
	import {news_list} from "@/API/news"
	export default{
		data(){
			return{
				page:1,
				list:{
					data:[]
				}
			}
		},
		mounted() {
			this.init()
		},
		methods:{
			init(page) {
				news_list({
					page: page || 1
				}).then(res => {
					this.list = res.data.data
					this.list.data = res.data.data.data;
				})
			},
			// 推荐页码改变调用接口
			tuijianchange(val) {
				this.init(val)
			}
		}
	}
</script>

<style>
</style>